package com.yanqu.road.server.timer.player;

import com.yanqu.road.entity.player.PlayerState;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.musicroom.MusicRoomModule;
import com.yanqu.road.server.gameplayer.module.player.EarnSpeedModule;
import com.yanqu.road.server.gameplayer.module.player.PlayerModule;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.executor.GeneralTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * 重置在线玩家每日数据
 *
 */
public class PlayerDataDailyResetTask extends GeneralTask {

	private static Logger logger = LogManager.getLogger(PlayerDataDailyResetTask.class.getName());

	@Override
	public void doRun() {
		for (GamePlayer player : GamePlayerMgr.getCopyPlayerMap().values()) {
			if(player.getState()== PlayerState.ONLINE){
				logger.info("每日任务定时器执行:玩家" + player.getModule(PlayerModule.class).getUserInfo().getNickName());
				player.getModule(EarnSpeedModule.class).resetDay();
			}
		}
	}

}
